package com.ssm.interceptor;


import com.ssm.pojo.User;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class loginInterceptor implements HandlerInterceptor {
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        User loginUser = (User) request.getSession().getAttribute("loginUser");
        if (loginUser==null){
            response.sendRedirect("unlogged.jsp");
        }
    }
}
